const main = r => require.ensure([], () => r(require('@/layout/main.vue')), 'main')
const index = r => require.ensure([], () => r(require('@/view/index/index.vue')), 'index')
const error = r => require.ensure([], () => r(require('@/view/404/404.vue')), 'error')

// 首页
const home = r => require.ensure([], () => r(require('@/view/home/home.vue')), 'home')

const defaultRouter = [
    {
        path: "/",
        component: main, // 布局页 -- 放置公共组件
        redirect: {
            name: "home"
        },
        children:[

            {
                path: '/home',
                component: home,
                name: 'home',
                // redirect: '/home',
                meta: {
                    title: 'home'
                },
                children:[

                    {
                        path: '/home',
                        component: home,
                        name: 'home',
                        meta: {
                            title: 'home'
                        },
                    }
                ]
            },
            {
                path: '/index',
                component: index,
                name: 'index',
                meta: {
                    title: 'index'
                }
            }
        ]
    },
    {
        path: '*',
        component: error,
        name: '404',
        meta: {
            title: '404'
        }
    }
]

export default defaultRouter;
